Computer Vision - Plant Seedlings Classification

Background and Context

Can we differentiate a weed from a crop seedling? The ability to do so effectively can mean better crop yields and better stewardship of the environment. The Aarhus University Signal Processing group, in collaboration with University of Southern Denmark, hasrecently released a dataset containing images of unique plants belonging to 12 species at several growth stages

Objective

The goal of the project is to create a classifier capable of determining a plant's species from a photo.

Dataset

Dataset consist of two file

Let's start coding!

Installing necessary library

Loading necessary libraries

Load the data for analysis

Shape of the data

Exploratory Data Analysis on the images

Images category count

Dataset distribution for images

Images from each class and their corresponding label

Observation

Data Preprocessing

Resizing of Images

As the images are already in 128*128 size, no resizing of images needed

Cleaning of Images

CNN Model 1

Gaussian Blur

Now we apply the gaussian blur to each 28x28 pixels array (image) to reduce the noise in the image

Normalization

Data normalization is an important step which ensures that each input parameter (pixel, in this case) has a similar data distribution. This makes convergence faster while training the network

Shape of the images

CNN Model 2

Removal of background from seedling images

Encoding y (Labels) variables

Shape of data (y)

Model building

Convolutional Neural Network (CNN)

CNN Model 1

Split the data into train and test

Model building

Model Execution

Observation

CNN Model 2

Lets try building another model with clean images ( removal of background from the seedling images)

Split the data into train and test

Model Building

Model Execution

Observation

Plotting the Train & Test Accuracy

CNN Model 1

CNN Model 2

Model Evaluation

CNN Model 1

CNN Model 2

Observation

Plotting the confusion matrix for the two best models

CNN Model 1

CNN Model 2

Observation

Conclusion & Insights